﻿using StationNF;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace DExSerConsoleV1
{
    internal static class Program
    {
        public const string MainProgramSN = "ProgramMutex{9FA5A119-810A-4F61-B8B8-27CD91947C5F}";        

        /// <summary>
        /// 应用程序的主入口点。
        /// </summary>
        [STAThread]
        static void Main()
        {
            bool createNew;
            Mutex tMainMutex= new Mutex(true, MainProgramSN,out createNew);
            try
            {
                if (createNew)
                {
                    Application.EnableVisualStyles();
                    Application.SetCompatibleTextRenderingDefault(false);
                    Application.Run(new FDexSerConsoleNF());
                }
                else
                {
                    MessageBox.Show("程序已运行，本次启动将被忽略。", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            finally
            {
                tMainMutex.Close();
            }
        }
    }
}
